import Layout from '@/layout/index';
import userStore from '@/store/modules/user';
var routes = function () {
    const module = 'lucy-cms';
    if(userStore().modules.includes(module)){
        return [
            {
                path: '/cms',
                component: Layout,
                name: 'CMS',
                meta: {
                    title: '内容管理',
                    icon: 'table',
                    noCache: true
                },
                children: [
                    {
                        path: 'category',
                        component: () => import('@/module/cms/pages/category/index.vue'),
                        name: 'Category',
                        meta: { title: '分类管理', icon: 'dict', noCache: true }
                    },
                    {
                        path: 'article',
                        component: () => import('@/module/cms/pages/article/index.vue'),
                        name: 'Article',
                        meta: { title: '文章管理', icon: 'log', noCache: true }
                    }
                ]
            },
            {
                path: '/cms/article',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: 'new',
                        component: () => import('@/module/cms/pages/article/new.vue'),
                        name: 'ArticleNew',
                        meta: { title: '文章新建', icon: 'user', noCache: true }
                    },
                    {
                        path: 'detail/:id(\\d+)',
                        component: () => import('@/module/cms/pages/article/detail.vue'),
                        name: 'ArticleDetail',
                        meta: { title: '详细内容', noCache: true }
                    },
                    {
                        path: 'grant/:id(\\d+)',
                        component: () => import('@/module/cms/pages/article/grant.vue'),
                        name: 'ArticleGrant',
                        meta: { title: '授权', noCache: true, activeMenu: '/cms/article' }
                    }
                ]
            },
            {
                path: '/cms/article/detail',
                component: Layout,
                hidden: true,
                children: [
                    {
                        path: ':id(\\d+)',
                        component: () => import('@/module/cms/pages/article/detail.vue'),
                        name: 'ArticleDetail',
                        meta: { title: '详细内容', noCache: false }
                    }
                ]
            },
            
        ]
    }
    return [];
    
}
export default routes